This controller was built in order to automatically switch off lights left on in my loft, with energy costs what they are now leaving lights on forgetfully is an expensive error.
There are three LED light strips in the loft, each one is individually controlled using this controller. From the instant any one of the lights is switched on a timer is activated for a two hour period, after which any enabled lights will be switched off and the timer reset. The timer period is easily changed in code. Any individual light can be toggled on or off during the timer period without affecting the time period. If all of the lights are switched off before the elapsed time, the timer is reset ready for the next time any light is activated.
The code and hardware allows up to four lights to be controlled
The controller uses a pic16f628a and a handful of other components. Solid state zero crossing relays are used to switch mains voltage to the LED strips, the relays are rated for a maximum of two amps which is more than adequate for most LED lights (the lights used here draw 250mA @230V each).Each light is turned on or off with a small push to make momentary push button, any number of buttons can be paralleled making for simple two/ three way switching etc. Here I have a set of buttons in the loft and another set at the foot of the stairs to the loft. For every push button there is a status led mounted above it. The controller requires a dc source of 6-15V, not a problem here as my loft is the radio shack.
The push buttons are connected to RB4-7, configured as inputs. RB0-3 are configured as outputs to drive the solid state relays. The pic code looks for a change of state on port RB4-7 using a service interrupt routine and acts upon this to switch on or off the corresponding light.
Barry Zarucki M0DGQ
HOME